package edu.unf.cen6940.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */
@IdClass(edu.unf.cen6940.domain.FacultyresearchtostudentPK.class)
@Entity
@NamedQueries({
		@NamedQuery(name = "findAllFacultyresearchtostudents", query = "select myFacultyresearchtostudent from Facultyresearchtostudent myFacultyresearchtostudent"),
		@NamedQuery(name = "findFacultyresearchtostudentByFacultyId", query = "select myFacultyresearchtostudent from Facultyresearchtostudent myFacultyresearchtostudent where myFacultyresearchtostudent.facultyId = ?1"),
		@NamedQuery(name = "findFacultyresearchtostudentByFacultyResearchId", query = "select myFacultyresearchtostudent from Facultyresearchtostudent myFacultyresearchtostudent where myFacultyresearchtostudent.facultyResearchId = ?1"),
		@NamedQuery(name = "findFacultyresearchtostudentByPrimaryKey", query = "select myFacultyresearchtostudent from Facultyresearchtostudent myFacultyresearchtostudent where myFacultyresearchtostudent.facultyResearchId = ?1 and myFacultyresearchtostudent.studentId = ?2 and myFacultyresearchtostudent.facultyId = ?3"),
		@NamedQuery(name = "findFacultyresearchtostudentByStudentId", query = "select myFacultyresearchtostudent from Facultyresearchtostudent myFacultyresearchtostudent where myFacultyresearchtostudent.studentId = ?1") })
@Table(catalog = "ThesisManagement", name = "FacultyResearchToStudent")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "rms_test/edu/unf/cen6940/domain", name = "Facultyresearchtostudent")
public class Facultyresearchtostudent implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "facultyResearchID", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer facultyResearchId;
	/**
	 */

	@Column(name = "studentID", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer studentId;
	/**
	 */

	@Column(name = "facultyID", nullable = false)
	@Basic(fetch = FetchType.EAGER)
	@Id
	@XmlElement
	Integer facultyId;

	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "facultyID", referencedColumnName = "facultyID", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Faculty faculty;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "facultyResearchID", referencedColumnName = "facultyResearchID", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Facultyresearch facultyresearch;
	/**
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns({ @JoinColumn(name = "studentID", referencedColumnName = "studentID", nullable = false, insertable = false, updatable = false) })
	@XmlTransient
	Student student;

	/**
	 */
	public void setFacultyResearchId(Integer facultyResearchId) {
		this.facultyResearchId = facultyResearchId;
	}

	/**
	 */
	public Integer getFacultyResearchId() {
		return this.facultyResearchId;
	}

	/**
	 */
	public void setStudentId(Integer studentId) {
		this.studentId = studentId;
	}

	/**
	 */
	public Integer getStudentId() {
		return this.studentId;
	}

	/**
	 */
	public void setFacultyId(Integer facultyId) {
		this.facultyId = facultyId;
	}

	/**
	 */
	public Integer getFacultyId() {
		return this.facultyId;
	}

	/**
	 */
	public void setFaculty(Faculty faculty) {
		this.faculty = faculty;
	}

	/**
	 */
	public Faculty getFaculty() {
		return faculty;
	}

	/**
	 */
	public void setFacultyresearch(Facultyresearch facultyresearch) {
		this.facultyresearch = facultyresearch;
	}

	/**
	 */
	public Facultyresearch getFacultyresearch() {
		return facultyresearch;
	}

	/**
	 */
	public void setStudent(Student student) {
		this.student = student;
	}

	/**
	 */
	public Student getStudent() {
		return student;
	}

	/**
	 */
	public Facultyresearchtostudent() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Facultyresearchtostudent that) {
		setFacultyResearchId(that.getFacultyResearchId());
		setStudentId(that.getStudentId());
		setFacultyId(that.getFacultyId());
		setFaculty(that.getFaculty());
		setFacultyresearch(that.getFacultyresearch());
		setStudent(that.getStudent());
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("facultyResearchId=[").append(facultyResearchId).append("] ");
		buffer.append("studentId=[").append(studentId).append("] ");
		buffer.append("facultyId=[").append(facultyId).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((facultyResearchId == null) ? 0 : facultyResearchId.hashCode()));
		result = (int) (prime * result + ((studentId == null) ? 0 : studentId.hashCode()));
		result = (int) (prime * result + ((facultyId == null) ? 0 : facultyId.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Facultyresearchtostudent))
			return false;
		Facultyresearchtostudent equalCheck = (Facultyresearchtostudent) obj;
		if ((facultyResearchId == null && equalCheck.facultyResearchId != null) || (facultyResearchId != null && equalCheck.facultyResearchId == null))
			return false;
		if (facultyResearchId != null && !facultyResearchId.equals(equalCheck.facultyResearchId))
			return false;
		if ((studentId == null && equalCheck.studentId != null) || (studentId != null && equalCheck.studentId == null))
			return false;
		if (studentId != null && !studentId.equals(equalCheck.studentId))
			return false;
		if ((facultyId == null && equalCheck.facultyId != null) || (facultyId != null && equalCheck.facultyId == null))
			return false;
		if (facultyId != null && !facultyId.equals(equalCheck.facultyId))
			return false;
		return true;
	}
}
